package com.jar.exercise.volatile_use;

public class Main {
	private static String name = "张三";

	public static void main(String[] args) {
		new Thread(() -> {
			try {
				Thread.sleep(2);
				System.out.println(name);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}).start();

		new Thread(() -> {
			if (!name.equals("张三")) {
				System.out.println("name被改变了");
			}
		}).start();
	}
}
